<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%
String path = request.getContextPath();
String orderNo = request.getParameter("orderNo");
%>
<%@ taglib uri="http://java.sun.com/jstl/core_rt" prefix="c"%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta http-equiv="X-UA-Compatible" content="IE=8">
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<meta content="B2B电商平台" name="description" />
<meta content="B2B电商平台" name="keyword" />

<title>B2B电商平台.订单提现</title>
<link rel="icon" href="include/images/icss.ico" type="image/x-icon" />
<link rel="shortcut icon" href="include/images/icss.ico" type="image/x-icon" />
<link rel="stylesheet" type="text/css" href="<%=path %>/include/css/global.css" />
<link rel="stylesheet" type="text/css" href="<%=path %>/include/css/style.css" />
<link rel="stylesheet" type="text/css" href="<%=path %>/include/css/pro.css" />
<link rel="stylesheet" type="text/css" href="<%=path %>/include/css/proManage.css" />
<link rel="stylesheet" href="<%=path%>/include/JQuery ui/css/smoothness/jquery-ui-1.7.3.custom.css" type="text/css"></link>
<link rel="stylesheet" type="text/css" href="<%=path%>/include/pagination/page.css" media="all">
<link rel="stylesheet" type="text/css" href="<%=path%>/include/css/mmt_trading.css" />
<link rel="stylesheet" type="text/css" href="http://style.org.hc360.com/js/build/source/widgets/wij/hc.wijmo.css" />
<link rel="stylesheet" type="text/css" href="http://style.org.hc360.com/js/build/source/widgets/wij/hc.wijcalendar.css" />
<link rel="stylesheet" type="text/css" href="<%=path %>/include/sweetalert/sweetalert.css" />

<script type="text/javascript" src="<%=path %>/include/js/jquery-1.8.0.min.js"></script>
<script src="<%=path %>/include/wijmo/external/jquery-ui-1.8.23.custom.min.js" type="text/javascript"></script>
<script src="<%=path %>/include/wijmo/external/globalize.min.js" type="text/javascript"></script>
<script src="<%=path %>/include/wijmo/external/cultures/globalize.cultures.js" type="text/javascript"></script>
<script src="<%=path %>/include/wijmo/wijmo/jquery.wijmo.wijpopup.js" type="text/javascript"></script>
<script src="<%=path %>/include/wijmo/wijmo/jquery.wijmo.wijcalendar.js" type="text/javascript"></script>
<script type="text/javascript" src="<%=path %>/include/js/cookies.js"></script>
<script type="text/javascript" src="<%=path %>/include/js/icss.busin.js"></script>
<script type="text/javascript" src="<%=path %>/include/js/icss.common.js"></script>
<script type="text/javascript" src="<%=path%>/include/pagination/jquery.pagination.js"></script>
<script type="text/javascript" src="<%=path%>/include/pagination/init.js"></script>
<script type="text/javascript" src="<%=path%>/include/js/doT.min.js"></script>
<script type="text/javascript" src="<%=path%>/include/layer/layer.js"></script>
<script type="text/javascript" src="<%=path%>/include/js/json2.js"></script>
<script type="text/javascript" src="<%=path %>/include/sweetalert/sweetalert.min.js"></script>
<script type="text/javascript" src="<%=path %>/include/sweetalert/sweetalert-dev.js"></script>
<script src="<%=path%>/include/DatePicker/WdatePicker.js" charset="UTF-8" type="text/javascript"></script>

<style type="text/css">

.colnums-2-ab-b {
	float: left;
	width: 100%;
	height: auto;
	font-size: 12px !important;
}

.listed_tb_k th.t1 {
	width: 44%;
	border-right: 0px solid #fff;
	padding: 0 5px;
}

.listed_tb_k th.t2 {
	width: 8%;
	border-right: 0px solid #fff;
}

.listed_tb_k th.t3 {
	width: 8%;
	border-right: 0px solid #fff;
}

.listed_tb_k th.t4 {
	width: 12%;
	border-right: 0px solid #fff;
}

.listed_tb_k th.t5 {
	width: 12%;
	border-right: 0px solid #fff;
}

.listed_tb_k th.t6 {
	width: 8%;
	border-right: 0px solid #fff;
}

.listed_tb_k th.t7 {
	width: 8%;
	border-right: 0px solid #fff;
}

.listed_tb_k tbody td.t2 .pic_50 {
	border: 1px solid #FFF;
	width: 50px;
	height: 50px;
	display: table-cell;
	vertical-align: middle;
	text-align: center;
	background-color: #fff;
}

.t4 {
	border-right: 1px solid #ddd;
}

.t5 {
	border-right: 1px solid #ddd;
}

.t6 {
	border-right: 1px solid #ddd;
}

.t7 {
	border-right: 1px solid #ddd;
}

#ajaxSerieslist td {
	border: 1px solid #ddd;
}

thead th {
	border: 1px solid #ddd;
	padding: 4px;
}

.sear {
	border: 1px solid #e0e0e0;
	background: #f5f5f5;
	margin-top: 10px;
	height: 80px;
	line-height: 40px;
	font-size: 14px;
}

ul li{list-style: none;}
.track-rcol{width: 96%; border: 1px solid #eee;}
.track-list{margin: 20px; padding-left: 5px; position: relative;}
.track-list li{position: relative; padding: 9px 0 0 25px; line-height: 18px; border-left: 1px solid #d9d9d9; color: #999;}
.track-list li.first{color: red; padding-top: 0; border-left-color: #fff;}
.track-list li .node-icon{position: absolute; left: -6px; top: 50%; width: 11px; height: 11px; background: url(<%=path %>/include/images/order-icons.png)  -21px -72px no-repeat;}
.track-list li.first .node-icon{background-position:0 -72px;}
.track-list li .time{margin-right: 20px; position: relative; top: 4px; display: inline-block; vertical-align: middle;}
.track-list li .txt{max-width: 600px; position: relative; top: 4px; display: inline-block; vertical-align: middle;}
.track-list li.first .time{margin-right: 20px; }
.track-list li.first .txt{max-width: 600px; }

th,td{text-align:center;vertical-align:middle;}
div.green span.disabled { margin:0px;padding: 0px 4px;}
.confirm, .cancel{background-image: url();}
.em_css{position: absolute;top: 60px;left: 325px;}
h2 {width: 100%;}

.saveButton{
    width:44px;
    height:24px;
    line-height:24px;   
    background-color: transparent;
    background-repeat: no-repeat;
    background-position: 0 -203px;
    border:0;
    cursor:pointer;
    font: 12px/1.5 arial,tahoma,\5b8b\4f53;
    margin: 0 0 0 5px;
    outline:none;
    background-image: url('<%=path%>/include/css/img/xs_bgx.png');   
}
</style>

<script type="text/javascript">
	$(document).ready(function() {
		_reHeight("rightFrame","contentDiv");
		$("#carteFlag").val("2");
		_queryList('2');
		$(".orange_search_btn3").on({
			mouseover:function(){
				$(this).css("font-size","14px");
			},
			mouseout:function(){
				$(this).css("font-size","12px");
			}
		});
	});

	function _orderDetail(){
		var className = $("#curtm").attr('class');
		if(className == "undefined"||className == null||className == ""){
			$("#curtm").removeClass().addClass("sel_current"); 
			$("#befm").removeClass(); 
			$("#thressfm").removeClass();
		}
		$("#carteFlag").val("2");
		_queryList('2');
	}

	function _deliverDetail(){
		var className = $("#befm").attr('class');
		if(className == "undefined"||className == null||className == ""){
			$("#befm").removeClass().addClass("sel_current"); 
			$("#curtm").removeClass(); 
			$("#thressfm").removeClass(); 
		}
		$("#carteFlag").val("4");
		_queryList('4');
	}
	function _discountDetail(){
		var className = $("#thressfm").attr('class');
		if(className == "undefined"||className == null||className == ""){
			$("#thressfm").removeClass().addClass("sel_current"); 
			$("#befm").removeClass(); 
			$("#curtm").removeClass(); 
		}
		$("#carteFlag").val("5");
		_queryList('5');
	}
	
    var pagination;
	function _queryList(status){
  		var url = "<%=path %>/orderFee/queryFeeList.do";
  		var begTime = $("#begTime").val();
  		var endTime = $("#endTime").val();
  		/*if(endTime<begTime){
  			parent.layer.alert("开始时间不应大于截止时间");
  			return;
  		}*/
  		var data = {
  				begTime : begTime,
  				endTime : endTime,
				status : status
		};
  		pagination = _initPagination({'pageId':'pagination', 'cKey':'toOrderFeeList','url': url,'data': data, 'rows': 10, 'callback':_initDataList});
	}

	function _initDataList(data) {
 		var d = data.rows;
 		var total = data.total;
		$("#ajaxSerieslist").empty();
		if(d.length<=0) $("#actualAmount").html("0");
		else {
			var amount = parseFloat(d[0].allOrderMoney)-parseFloat(d[0].allRefundMoney);
			amount = amount.toFixed(2);
			var allOrderMoney = d[0].allOrderMoney;
			var allRefundMoney = d[0].allRefundMoney;
			var amountInfo = allOrderMoney+"-<span style='color:red;'>"+allRefundMoney+"</span>="+amount;
			$("#actualAmount").html(amountInfo);
		}
		var html = '';
		for(var i=0;i<d.length;i++){
			var refundTip = "";
			if(parseFloat(d[i].REFUND_MONEY)>0){
				refundTip = "有退款";
			}
			html += "<tr style='line-height:35px;'>";
			html += "	<td>"+d[i].PID+"</td>";
			html += "	<td style='text-align: left;padding: 0 4px;' nowrap>"+d[i].ORDER_NO+" <span style='color:red;'>"+refundTip+"</span></td>";
			html += "	<td nowrap>"+d[i].CON_NAME+"</td>";
			html += "	<td nowrap>"+d[i].CREATE_TIME+"</td>";
			html += "	<td style='text-align: right;padding: 0 4px;' nowrap>"+d[i].ORDER_MONEY+"</td>";
			html += "	<td style='text-align: right;padding: 0 4px;' nowrap>";
			if(parseFloat(d[i].REFUND_MONEY)>0){
				html += "	"+d[i].REFUND_MONEY+"";
			}
			html += "	</td>";
			html += "	<td style='text-align: right;padding: 0 4px;' nowrap>"+d[i].ALL_FEE_MONEY+"</td>";
			html += "	<td style='text-align: right;padding: 0 4px;' nowrap>"+d[i].ACTUALAMOUNT+"</td>";
			html += "</tr>";
		}	
		$("#ajaxSerieslist").append(html);
		_reHeight("rightFrame", "contentDiv");
	 }
	 
	 function _tixianNew(){
	 	var balanceCheck = "<c:out value='${balanceCheck}'/>";
	 	if(balanceCheck=="false"){
	 		parent.swal("店铺余额异常，请联系管理员","", "info");
	 		return false;
	 	}
	 
	 	var DclientH =  window.screen.height ;
	 	var DclientW =  window.screen.width ;
		var offheight = 0;
		var offwidth = 0;
		offheight = (DclientH-360)/2;
		offwidth = (DclientW-460)/2;
	 	var url = "<%=path %>/orderFee/tixian.do";
	 	parent.layer.open({
  			title: "我要提现",
  			type: 2, 
  			fixed: true,
  			area: ['460px', '360px'],
  			offset : [offheight , offwidth],
  			content: [url,'no'], 
  			fixed: false, //不固定
			end: function(index, layero){ 
  				
  				return false; 
			}    
		});
	 }
	 
	function _tixian(bankAccount,money,bankAccountName){
    	var htmlStr = "<div style='margin-top:10px;width:100%;text-align:center;overflow:hidden;'>";
    	htmlStr +="		<div style='width:40%;float:left;text-align:right;height: 30px;'>银行卡号：</div>";
    	htmlStr +="		<div style='width:60%;float:left;height: 30px;line-height: 30px;'>";
    	htmlStr +="			<input type=\'text\' id=\'bankAccount\' name=\'bankAccount\' value=\'"+bankAccount+"\' style=\"text-align:right;border: 1px solid #c7c7c7;height: 26px;width: 180px;\" />";
    	htmlStr +="			<div id='addPriceSpan' style='color:red;text-align: left;font-size: 14px;'></div>";
    	htmlStr +="		</div>";
    	htmlStr +="		<div style='width:40%;float:left;text-align:right;height: 30px;'>收款人姓名：</div>";
    	htmlStr +="		<div style='width:60%;float:left;height: 30px;'>";
    	htmlStr +="			<input type=\'text\' id=\'bankAccountName\' name=\'bankAccountName\' value=\'"+bankAccountName+"\' style=\"text-align:right;border: 1px solid #c7c7c7;height: 26px;width: 180px;\" />";
    	htmlStr +="			<div id='addPriceSpan' style='color:red;text-align: left;font-size: 14px;'></div>";
    	htmlStr +="		</div>";
    	htmlStr +="		<div style='width:40%;float:left;text-align:right;height: 30px;'>金额（￥）：</div>";
    	htmlStr +="		<div id='moneyId' style='width:60%;float:left;height: 30px;'>";
    	htmlStr +="			<input type=\'text\' id=\'money\' name=\'money\' value=\'"+money+"\' style=\"text-align:right;border: 1px solid #c7c7c7;height: 26px;width: 180px;\" />";
    	htmlStr +="		<div id='moneySpan' style='color:red;text-align: left;font-size: 14px;position: absolute;'></div></div>";
    	htmlStr +="		<div style='float:left;height: 30px;width:40%;height: 30px;text-align:right;'>";
    	htmlStr +="			<em>可提现金额（￥）：";
    	htmlStr +="		</div>";
    	htmlStr +="		<div style='float:left;height: 30px;width:60%;height: 30px;text-align:left;'>";
    	htmlStr +="			<em>"+money+"<a style='padding-left:10px' href='javascript:void(0)' onclick=\"_setValue('"+money+"')\">提现全部金额</a></em>";
    	htmlStr +="		</div>";
    	htmlStr +="</div>";
    	
    	parent.swal({   
			title: "提现",  
			text: htmlStr,   
			html: true,
			showCancelButton: true,
			closeOnConfirm: false,
			cancelButtonText: "取消",
			cancelButtonColor: "#ec6c62",
			confirmButtonText: "确定",
			confirmButtonColor: "#ec6c62",  
			animation: "slide-from-top"
		}, function(){
				parent.swal("正在建设中...","", "info");
				return;   
				var money1 = parent.document.getElementById("money").value;
				var result = parseFloat(money)<parseFloat(money1);
				if(result){
					window.parent.document.getElementById("moneySpan").innerHTML = "金额应不大于可提现金额！";
					window.parent.document.getElementById("moneyId").style.height=40;
					return;
				}else{
					window.parent.document.getElementById("moneySpan").innerHTML = "";
					window.parent.document.getElementById("moneyId").style.height=30;
					return;
				}
		});
    }
    function _setValue(money){
    	$("#money").val(money);
    }
    function _clickQuery(){
    	var carteFlag = $("#carteFlag").val();
		_queryList(carteFlag);
    }
    function _dealInfo(){
    	window.location.href="<%=path%>/orderFee/toAgentOrderPage.do";
    }
    function _export(){
    	var begTime = $("#begTime").val();
  		var endTime = $("#endTime").val();
		var status = $("#carteFlag").val();
		var url = "<%=path%>/orderFee/exportOrderFeeInfo.do?begTime="+begTime+"&endTime="+endTime+"&status="+status;
	 	window.open(url);
 	}
</script>
</head>

<body style="font-family: '微软雅黑'">
	<div id="contentDiv" style="padding:5px; width:99%;">
		<div class="colnums-2-ab-b">
		<div class="toptil">销售金额统计 <div style="float: right;margin: 5px 40px 0px 0px;"></div></div>
		<div class="sear" style="width: 99%;padding-left: 4px;overflow:hidden;height:auto;">
				<div style="width:78.5%;border:0px solid red;float:left;background-color: #FAFAFA;border-right: 1px dashed #E0E0E0;">
					<div style="font-weight:bold;margin: 5px 0px 0px 10px;height:40px;line-height:50px;width:100%">
						可提现金额（￥）：<em>${shopMoney.ALL_REAL_MONEY } - <c:out value='${agentPayMoney.OVER_MONEY }'/> - <c:out value='${agentPayMoney.PAYING_MONEY }'/> = <c:out value='${agentMoney }'/> </em> 
					</div>
					<div style="float:left;font-size:14px;font-weight:bold;margin: -5px 0px 5px 10px;height:40px;line-height:40px;width:100%;color:red;">
						注：可提现金额=已确认订单金额（扣除手续费）- 已提现金额 - 提现处理中金额
					</div>
				</div>
				<div style="float:left;width:21.3%;height:85px;text-align: center;">
					<div style="border:0px;margin-top: 22px">
						<button id="queryBtn" class="orange_search_btn3" onclick="_tixianNew()" >提现</button>&nbsp;
						<button id="queryBtn" class="orange_search_btn3" onclick="_dealInfo()" >提现流水</button>
					</div>
				</div>
			</div>
			<!-- 
			<div class="sear" style="width:99%;padding-bottom: 10px;height:100px;background-color: #FAFAFA;overflow: hidden;display: none;">
				<div style="float:left;width:450px;">
					<div style="font-weight:bold;margin-left: 10px;height:50px;line-height:50px;width:100%">
						可提现金额（￥）：<em>${actualAmount.ACTUALAMOUNT } - <c:out value='${agentPayMoney.OVER_MONEY }'/> - <c:out value='${agentPayMoney.PAYING_MONEY }'/> = <c:out value='${agentMoney }'/> </em> 
					</div>
				</div>
				<div style="float:left;margin: 10px auto;border:0px solid blue;width:161px;">
					<button id="queryBtn" class="orange_search_btn3" onclick="_tixianNew()" >提现</button>&nbsp;
					<button id="queryBtn" class="orange_search_btn3" onclick="_dealInfo()" >提现流水</button>
				</div>
				<div style="float:left;font-size:14px;font-weight:bold;margin-left: 10px;height:50px;line-height:50px;width:100%;color:red;">
					注：可提现金额=已确认订单金额（扣除手续费）- 已提现金额 - 提现处理中金额
				</div>
			</div>
			 -->
			<p class="progra"></p>
			<div class="tag_x" style="padding: 0px; width: 100%;">
				<a id="curtm" href="javascript:_orderDetail();" class="sel_current" style="cursor:pointer;">已支付</a> 
				<a id="befm" href="javascript:_deliverDetail();" style="cursor:pointer;">已送货</a>
				<a id="thressfm" href="javascript:_discountDetail();" style="cursor:pointer;">已收货</a>
			</div>
			<div id="msgDiv" style="margin-top:5px;width:100%;padding:1%;border:none;">
				<!-- 
				<span style="font-weight:bold;height:30px;line-height:30px;display:inline-block;">入账金额（￥）：</span><span id="realAmount"></span>
				 -->
				 <table style="width: 100%;border: 0px;text-align: left;">
				 	<tr>
				 		<td style="width: 40%;text-align: left;">
				 			<span style="font-weight:bold;height:30px;line-height:30px;display:inline-block;">订单金额（￥）：</span><span id="actualAmount"></span>&nbsp;&nbsp;
				 		</td>
				 		<td style="text-align: left;">
				 			日期：<input type="text" id="begTime" name="begTime" onClick="WdatePicker({dateFmt:'yyyy-MM-dd'})" 
							    	style="width: 100px;height: 24px; padding-left: 3px" onfocus="WdatePicker({position:{left:390,top:193}})" class="Wdate" value=""/>
				 			- <input type="text" id="endTime" name="endTime" onClick="WdatePicker({dateFmt:'yyyy-MM-dd'})" 
							    	style="width: 100px;height: 24px; padding-left: 3px" onfocus="WdatePicker({position:{left:501,top:193}})" class="Wdate" value=""/>
							<button id="queryBtn1" class="saveButton" onclick="_clickQuery()" >查询</button>
							<button id="queryBtn1" class="saveButton" onclick="_export()" >导出</button>
							<input id="carteFlag" name="carteFlag" type="hidden"/>
				 		</td>
				 	</tr>
				 </table>
			</div>
			<div id="orderDiv" class="listed_tb_k" style="padding:1% 1% 1% 0px;margin-top:0px;width:99.5%;border:none;">
				<table cellspacing="0" cellpadding="0" style="width: 99%">
					<thead>
						<tr>
							<th style="width:4%;"  nowrap>序号</th>
							<th style="width:20%;" nowrap>订单号</th>
							<th style="width:10%;" nowrap>买家姓名</th> 
							<th style="width:16%;" nowrap>时间</th>
							<th style="width:10%;" nowrap>订单金额（￥）</th>
							<th style="width:10%;" nowrap>退款金额（￥）</th>
							<th style="width:10%;" nowrap>手续费（￥）</th>
							<th style="width:10%;" nowrap>入账金额（￥）</th>
							<!-- 
							 -->
						</tr>
					</thead>
					<tbody id="ajaxSerieslist">
					</tbody>
				</table>
				<div id="pagination"></div>
			</div>
		</div>
	</div>
</body>
</html>
